//===============================================================================
// Microsoft patterns & practices Enterprise Library
// Data Access Application Block
//===============================================================================

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
using System;
using System.Configuration;

namespace EntLibContrib.Data.MySql
{
    /// <summary>
    /// Represents the process to build an instance of <see cref="MySqlDatabase"/>
    /// described by configuration information.
    /// </summary>
    /// 
    /// <author>Wesley Hobbie</author>
    /// <version>1.00</version> 12/21/2005
    public class MySqlDatabaseAssembler : IDatabaseAssembler
    {
        /// <summary>
        /// Builds an instance of <see cref="MySqlDatabase"/>, based on the
        /// provided connection string.
        /// </summary>
        /// <param name="name">The name for the new database instance.</param>
        /// <param name="connectionStringSettings">The connection string for
        /// the new database instance.</param>
        /// <param name="configurationSource">The source for any additional
        /// configuration information.</param>
        /// <returns>The new mysql database instance.</returns>
        public Database Assemble(string name,
            ConnectionStringSettings connectionStringSettings,
            IConfigurationSource configurationSource)
        {
            return new MySqlDatabase(connectionStringSettings.ConnectionString);
        }
    }
}
